data "huaweicloud_identity_role" "obs-admin" {
  name = "system_all_159"
}


resource "huaweicloud_identity_user" "iam-obs-miniapp-dev" {
  name        = "iam-obs-miniapp-dev"
  enabled     = true
  access_type = "programmatic"
}
resource "huaweicloud_identity_user" "iam-obs-myapp-dev" {
  name        = "iam-obs-myapp-dev"
  enabled     = true
  access_type = "programmatic"
}



resource "huaweicloud_identity_group" "group-superhub-obs-dev" {
  name        = "group-superhub-obs-dev"
  description = "group-superhub-obs-dev"
}

resource "huaweicloud_identity_group_membership" "membership-superhub-obs-dev" {
  group = huaweicloud_identity_group.group-superhub-obs-dev.id
  users = [
    huaweicloud_identity_user.iam-obs-miniapp-dev.id,
    huaweicloud_identity_user.iam-obs-myapp-dev.id
  ]
}

resource "huaweicloud_identity_group_role_assignment" "assginment_obs_admin_to_group" {
  group_id              = huaweicloud_identity_group.group-superhub-obs-dev.id
  role_id               = data.huaweicloud_identity_role.obs-admin.id
  enterprise_project_id = var.enterprise_project_id
  /* enterprise_project_id = "c94f1bfd-7662-4c85-a4cb-90080d5b0b85" */
}
